package com.my.domain.dto;

import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * Created by Administrator on 2017/6/12.
 */
@Data
@NoArgsConstructor
public class Column {
    private String  columnName;
    private String  columnDataType;
    private Integer columnLength;
    private Integer columnIsPri;
    private Integer columnIsNull;

    public static class Builder{
        //
        private String  columnName;
        private String  columnDataType;

        private Integer columnLength;
        private Integer columnIsPri;
        private Integer columnIsNull;

        public Builder(String columnName, String columnDataType){
            this.columnName = columnName;
            this.columnDataType = columnDataType;
        }

        public Builder columnLength(int columnLength){
            this.columnLength = columnLength;
            return this;
        }

        public Builder columnIsPri(int columnIsPri){
            this.columnIsPri = columnIsPri;
            return this;
        }

        public Builder columnIsNull(int columnIsNull){
            this.columnIsNull = columnIsNull;
            return this;
        }

        public Column build(){
            return  new Column(this);
        }

    }

   /* public Column(String columnName, String columnDataType){
        this(columnName, columnDataType, 0);
    }

    public Column(String columnName, String columnDataType, Integer columnLength){
        this(columnName, columnDataType, columnLength, 0, 0);
    }

    public Column(String columnName, String columnDataType, Integer columnLength,
                  Integer columnIsPri, Integer columnIsNull){
        this.columnName = columnName;
        this.columnDataType = columnDataType;
        this.columnLength = columnLength;
        this.columnIsPri = columnIsPri;
        this.columnIsNull = columnIsNull;
    }*/

    public Column(Builder builder){
        this.columnName = builder.columnName;
        this.columnDataType = builder.columnDataType;
        this.columnLength = builder.columnLength;
        this.columnIsPri = builder.columnIsPri;
        this.columnIsNull = builder.columnIsNull;
    }

}
